﻿using Microsoft.Extensions.DependencyInjection;
using StartsEAS_API.BLL.Interfaces.INoticeB;
using StartsEAS_API.DAL.NoticeD;
using StartsEAS_API.Model;
using StartsEAS_API.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StartsEAS_API.BLL.NoticeB
{
    public class NoticeBLL : INoticeBLL
    {
        private readonly StarsEASContext _context;
        public NoticeDAL _noticeDal;
        public NoticeBLL(IServiceScopeFactory context)
        {
            _context = context.CreateScope().ServiceProvider.GetRequiredService<StarsEASContext>();
            _noticeDal = new(_context);
        }
        public ResultUtils GetAllNotice()
        {
            return _noticeDal.GetAllNotice();
        }

        public ResultUtils GetAllNoticeByNoticeId(int NoticeId)
        {
            return _noticeDal.GetAllNoticeByNoticeId(NoticeId);
        }

        public ResultUtils InsertNotice(Notice notice)
        {
            return _noticeDal.InsertNotice(notice);
        }

        public ResultUtils UpdateNotice(Notice data)
        {
            return _noticeDal.UpdateNotice(data);
        }
    }
}
